<template>
    <div id="aside-expand" :style="{opacity:homeStore.state.expand===true?1:0}" v-if="homeStore.state.expand===true">
      <div class="title">
        <Menu />
        <span>{{$t('aside.menu')}}</span>
      </div>
      <div class="border"></div>
      <div class="menu">
        <div class="menu-item" :class="asideStore.state.activeHomeName === 'musicalMake' ? 'menu-item-active':''" @click="pushRoute('musicalMake','/front/musical/make')">
          <DataAnalysis/>
          <span class="menu-title">{{$t('aside.makemusical')}}</span>
        </div>
      </div>
    </div>
    <div id="aside-fold" :style="{opacity:homeStore.state.expand===true?0:1}" v-if="homeStore.state.expand===false">
      <div class="title">
        <Menu />
      </div>
      <div class="border"></div>
      <div class="menu">
        <div class="menu-item" :class="asideStore.state.activeHomeName === 'musicalMake' ? 'menu-item-active':''" @click="pushRoute('musicalMake','/front/musical/make')">
          <DataAnalysis/>
        </div>
      </div>
    </div>
</template>

<script setup>
import {Notebook, EditPen, DataAnalysis,Menu,Remove,Memo} from "@element-plus/icons-vue";
import {asideStore} from "@/store/aside";
import {homeStore} from "@/store/home";
import {onMounted, ref} from "vue";
import router from "@/router";

function pushRoute(name,path){
  asideStore.state.activeHomeName = name
  localStorage.setItem('activeHomeName',name)
  router.replace(path)
}

onMounted(()=>{
  let data = localStorage.getItem('activeHomeName')
  if(data!==null&&data!==undefined&&data!==''){
    asideStore.state.activeHomeName=data
  }
})

</script>

<style scoped>

::v-deep abbr[title] {
  text-decoration: none !important;
}

::v-deep .el-popover__title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: bold;
}

#aside-expand{
  transition: opacity 0.3s ease;
}

#aside-expand .title{
  display: flex;
  align-items: center;
  padding: 18px 15px 10px 15px;
}

#aside-expand .title svg{
  width: 18px;
  height: 18px;
  margin-right: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#aside-expand .title span{
  font-size: 16px;
  letter-spacing: 0.5px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: auto 0;
}

#aside-expand .border{
  border-bottom: 1px solid #c6c6c6;
  width: 90%;
  margin: 0 auto 5px;
}

#aside-expand .menu{
  padding: 0 20px 20px 20px;
  overflow: auto;
  height: 30vh;
}

#aside-expand .menu .menu-item-active{
  display: flex;
  margin-bottom: 10px;
  width: 100%;
  /*border: 1px solid #c6c6c6;*/
  border-radius: 5px;
  padding: 5px;
  color: var(--main-color) !important;

  .menu-title{
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    color: var(--main-color) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;
  }

  .remove{
    display: flex;
    align-items: center;
    color: #2c3e50;
  }
}

#aside-expand .menu .menu-item{
  display: flex;
  margin-bottom: 10px;
  width: 100%;
  /*border: 1px solid #c6c6c6;*/
  border-radius: 5px;
  padding: 5px;

  .menu-title{
    font-size: 14px;
    font-weight: bold;
    color:#8f8f8f;
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;
  }

  .remove{
    display: flex;
    align-items: center;
    color: #2c3e50;
  }

}

#aside-expand .menu .menu-item:hover{
  cursor: pointer;
  color: #000000bb;
  .menu-title{
    color: #000000bb;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;
  }

}

#aside-expand .menu .menu-item .remove:hover{
  display: flex;
  align-items: center;
  scale: 1.2;
  color: red;
}

#aside-expand .menu .menu-item svg{
  width: 15px;
  height: 15px;
  margin-right: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#aside-expand .menu .menu-item span{
  font-size: 15px;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#aside-fold{
  transition: opacity 0.3s ease;
  //position: absolute;
  //top: 6vh;
  //left: 8px;
}

#aside-fold .title{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 10px 10px 10px;
}

#aside-fold .title svg{
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#aside-fold .border{
  border-bottom: 1px solid #c6c6c6;
  width: 90%;
  margin: 0 auto 5px;
}

#aside-fold .menu{

}

#aside-fold .menu .menu-item-active{
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  width: 100%;
  border-radius: 5px;
  padding: 5px;
  color: var(--main-color) !important;

  .menu-title{
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    color: var(--main-color) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;
  }

}

#aside-fold .menu .menu-item-active .remove:hover{
  display: flex;
  align-items: center;
  scale: 1.2;
  color: red;
}

#aside-fold .menu .menu-item{
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  width: 100%;
  /*border: 1px solid #c6c6c6;*/
  border-radius: 5px;
  padding: 5px;
}

#aside-fold .menu .menu-item:hover{
  cursor: pointer;
  color: var(--main-color);
}

#aside-fold .menu .menu-item .remove:hover{
  display: flex;
  align-items: center;
  scale: 1.2;
  color: red;
}

#aside-fold .menu .menu-item svg{
  width: 15px;
  height: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#aside-fold .menu .menu-item span{
  font-size: 15px;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#inner-menu-item{
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border-radius: 5px;
  padding: 2px;
  gap:8px;
  margin-bottom: 4px;

  .menu-title{
    font-size: 13px;
    font-weight: bold;
    color:#8f8f8f;
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;

    &:hover{
      color:#000;
    }
  }

  .remove{
    display: flex;
    align-items: center;
    color: #2c3e50;
  }

  svg{
    width: 15px;
    height: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  span{
    font-size: 15px;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .icon{
    width: 15px;
    height: 15px;
  }

  .remove{
    width: 15px;
    height: 15px;

    &:hover{
      display: flex;
      align-items: center;
      scale: 1.2;
      color: red;
    }
  }

  &:hover{
    cursor: pointer;
    color: var(--main-color);
  }
}

#inner-menu-item-active{
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border-radius: 5px;
  padding: 2px;
  gap:8px;
  margin-bottom: 4px;

  .menu-title{
    font-size: 13px;
    font-weight: bold;
    color:var(--main-color);
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 80%;
    display: block;
    text-align: left;
  }

  .remove{
    display: flex;
    align-items: center;
    color: #2c3e50;
  }

  svg{
    width: 15px;
    height: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  span{
    font-size: 15px;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .icon{
    width: 15px;
    height: 15px;
    color:var(--main-color);

  }

  .remove{
    width: 15px;
    height: 15px;

    &:hover{
      display: flex;
      align-items: center;
      scale: 1.2;
      color: red;
    }
  }
}
</style>
